<?php

/**
 * Address form base class.
 *
 * @package    form
 * @subpackage address
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseAddressForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'unit_no'             => new sfWidgetFormInput(),
      'building_name'       => new sfWidgetFormInput(),
      'building_no'         => new sfWidgetFormInput(),
      'street'              => new sfWidgetFormInput(),
      'village_subdivision' => new sfWidgetFormInput(),
      'barangay'            => new sfWidgetFormInput(),
      'city'                => new sfWidgetFormInput(),
      'zip_code'            => new sfWidgetFormInput(),
      'type'                => new sfWidgetFormInput(),
      'country'             => new sfWidgetFormInput(),
      'person_id'           => new sfWidgetFormDoctrineChoice(array('model' => 'Person', 'add_empty' => true)),
      'client_id'           => new sfWidgetFormDoctrineChoice(array('model' => 'Client', 'add_empty' => true)),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorDoctrineChoice(array('model' => 'Address', 'column' => 'id', 'required' => false)),
      'unit_no'             => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'building_name'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'building_no'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'street'              => new sfValidatorString(array('max_length' => 255)),
      'village_subdivision' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'barangay'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'city'                => new sfValidatorString(array('max_length' => 255)),
      'zip_code'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'type'                => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'country'             => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'person_id'           => new sfValidatorDoctrineChoice(array('model' => 'Person', 'required' => false)),
      'client_id'           => new sfValidatorDoctrineChoice(array('model' => 'Client', 'required' => false)),
      'created_at'          => new sfValidatorDateTime(array('required' => false)),
      'updated_at'          => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('address[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Address';
  }

}
